﻿using RuoVea.ExDto;
using RuoVea.ExEnum;
using RuoVea.ExSugar.Attributes;
using RuoVea.ExSugar.Entity;
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace RuoVea.OmiApi.Config.Entitys;

/// <summary>
/// 参数配置表
/// </summary>
[SugarTable(nameof(SysConfig), "参数配置表")]
[Description("参数配置表")]
[Tenant("0")]
public class SysConfig : EntityBase, ITenantEntity
{
    /// <summary>
    /// 租户Id
    /// </summary>
    [ConfigSugarTenantColumn("TenantId", "租户Id", false, true, false)]
    public long? TenantId { get; set; }
    /// <summary>
    /// 名称
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Name), columnDescription: "名称", Length = 64)]
    [Required, MaxLength(64)]
    public string Name { get; set; }

    /// <summary>
    /// 编码
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Code), columnDescription: "编码", Length = 64)]
    [MaxLength(64)]
    public string Code { get; set; }

    /// <summary>
    /// 属性值
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Value), columnDescription: "属性值", Length = 64)]
    [MaxLength(64)]
    public string Value { get; set; }

    /// <summary>
    /// 是否是系统参数（Y-是，N-否）
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(SysFlag), columnDescription: "是否是系统参数（1-是，0-否）", IsNullable = true)]
    public YesOrNot? SysFlag { get; set; } = YesOrNot.N;

    /// <summary>
    /// 备注
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Remark), columnDescription: "备注", Length = 256, IsNullable = true)]
    [MaxLength(256)]
    public string Remark { get; set; }

    /// <summary>
    /// 状态-正常_0、停用_1 
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(IsDisable), columnDescription: "是否禁用", IsNullable = true)]
    public YesOrNot? IsDisable { get; set; } = YesOrNot.N;

    /// <summary>
    /// 常量所属分类的编码，来自于“常量的分类”字典
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(GroupCode), columnDescription: "分组编码", Length = 64, IsNullable = true)]
    [MaxLength(64)]
    public string GroupCode { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Sort), columnDescription: "排序", DefaultValue = "100", IsNullable = true)]
    public int? Sort { get; set; } = 100;
}
